package com.aaa.service.jl.impl;

import com.aaa.dao.jl.PlanSasDao;
import com.aaa.pojo.jl.PlanSas;
import com.aaa.service.jl.PlanSasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PlanSasServiceImpl implements PlanSasService {
    @Autowired
    private PlanSasDao planSasDao;

    @Override
    public List<PlanSas> findAll() {
        List<PlanSas> all = planSasDao.findAll();
        return all;
    }

    @Override
    public List<PlanSas> findAll1(String page, String limit) {
        int pageInt = Integer.parseInt(page);
        int limitInt = Integer.parseInt(limit);
        int start = (pageInt-1)*limitInt;
        List<PlanSas> all1 = planSasDao.findAll1(start,limitInt);
        return all1;
    }

    @Override
    public int findCount() {
        return planSasDao.findCount();
    }

    @Override
    public int insert(PlanSas planSas) {
        return  planSasDao.insert(planSas);
    }

    @Override
    public int update(PlanSas planSas) {
        return planSasDao.update(planSas);
    }

    @Override
    public int deleteList(List idList) {
        return planSasDao.deleteList(idList)    ;
    }

    @Override
    public int delete(String idList) {
        return planSasDao.delete(Integer.parseInt(idList));
    }

    @Override
    public List<PlanSas> fuzzyPlanSas(String testName, String createBy,String page ,String limit) {
        int pageInt = Integer.parseInt(page);
        int limitInt = Integer.parseInt(limit);
        int start = (pageInt-1)*limitInt;
        return planSasDao.fuzzyPlanSas(testName,createBy,start,limitInt);
    }

    @Override
    public int queryCountLike(String question, String createBy) {
        return planSasDao.queryCountLike(question,createBy);
    }
}
